import Decimal from 'decimal.js';
type NumVal = string | number;
/**
 * @description 加
 */
export const addDec = (a: NumVal = 0, b: NumVal = 0): string => {
  return new Decimal(a).add(new Decimal(b)).toString();
};
/**
 * @description 减
 */
export const subDec = (a: NumVal = 0, b: NumVal = 0): string => {
  return new Decimal(a).sub(new Decimal(b)).toString();
};
/**
 * @description 乘
 */
export const mulDec = (a: NumVal = 0, b: NumVal = 0): string => {
  return new Decimal(a).mul(new Decimal(b)).toString();
};
/**
 * @description 除
 */
export const divDec = (a: NumVal = 0, b: NumVal = 0): string => {
  return new Decimal(a).div(new Decimal(b)).toString();
};

/**
 * @description 最大值
 */
export const max = (...vals: NumVal[]) => {
  return Decimal.max(...vals).toString()
}
/**
 * @description 最小值
 */
export const min = (...vals: NumVal[]) => {
    return Decimal.min(...vals).toString();
}

export const pow = (val1: NumVal, val2: NumVal) => {
    return Decimal.pow(val1, val2).toString()
}
export const negated = (val: NumVal) => {
    return new Decimal(val).negated().toString();
}